home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’95 / Snuffy (Moof!) - Magic Cap / Source / Snuffy.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-24  |  4.4 KB  |  131 lines  |  [TEXT/MPS ]

  1. //
  2. //    Snuffy
  3. //
  4. //    A silly hack that snuffs Sniffy and replaces him with a more loyal
  5. //  companion of a sadly endangered species.
  6. //
  7. //    Written at MacHack '95 in a shitty hotel in Southfield, Michigan
  8. //
  9. //    © 1995 Steve Klingsporn (moofie@dogcow.com)
  10. //
  11. //    Note:  The dogcow image is a trademark of Apple Computer, Inc.,
  12. //           and is used without permission.  If someone at Apple wants to
  13. //           yell and scream at me, they're welcome to -- my contact
  14. //           information is on the name card I install in the name card file.
  15. //
  16. //    Version:    1.0
  17. //
  18.  
  19. #include "Magic.h"
  20. #include "Debug.h"
  21. #include "Package.h"  
  22.  
  23.  
  24. //  Constants I define for system indexicals which are curiously
  25. //  undocumented in Indexicals.h
  26.  
  27. #define iFindButtonImage                    MakeIndexical(6,195)
  28. #define iStandingLookingImage1                MakeIndexical(6,405)
  29. #define iStandingLookingImage2                MakeIndexical(6,406)
  30. #define iStandingLookingForwardImage        MakeIndexical(6,407)
  31. #define iWalkingImage1                        MakeIndexical(6,404)
  32. #define iWalkingImage2                        MakeIndexical(6,403)
  33. #define iWalkingImage3                        MakeIndexical(6,402)
  34. #define iWalkingImage4                        MakeIndexical(6,401)
  35.  
  36.  
  37. //    Indexicals I define for my hack-like evil things I install
  38.  
  39. #define iFindButtonHackImage                MakePackageIndexical(25,1)
  40. #define iStandingLookingHackImage1            MakePackageIndexical(25,2)
  41. #define iStandingLookingHackImage2            MakePackageIndexical(25,3)
  42. #define iStandingLookingForwardHackImage    MakePackageIndexical(25,4)
  43. #define iWalkingHackImage1                    MakePackageIndexical(25,5)
  44. #define iWalkingHackImage2                    MakePackageIndexical(25,6)
  45. #define iWalkingHackImage3                    MakePackageIndexical(25,7)
  46. #define iWalkingHackImage4                    MakePackageIndexical(25,8)
  47. #define iSniffyDeathAnnouncement            MakePackageIndexical(25,9)
  48.  
  49.  
  50. //    Main stub (should not contain code)
  51.  
  52. main() 
  53. {
  54. }
  55.  
  56.  
  57. #undef CURRENTCLASS
  58. #pragma segment InstallerKibble
  59. #define CURRENTCLASS InstallerKibble
  60.  
  61.  
  62. //
  63. //      Class:    InstallerKibble
  64. //
  65. //     Method:    SnuffSniffy
  66. //
  67. //    Purpose:    Pops a fake Sniffy stamp out of the Magic Lamp and sends him hurling 
  68. //                into the trash.  Deletes the fake Sniffy stamp from the trash so the
  69. //                effect of him actually dying is preserved.  Plays the trash
  70. //                drum sound but does not actually empty the trash (because
  71. //                this would be an uncool thing to do).
  72. //
  73.  
  74. Method void InstallerKibble_SnuffSniffy(ObjectID self)
  75. {
  76.     ObjectID    tempSniffy;
  77.             
  78.     tempSniffy = New(Stamp_, nilObject);            //  New fake Sniffy stamp
  79.     SetImage(tempSniffy, iStandingLookingImage2);    //    Set the image to Sniffy
  80.     
  81.     SetSuperview(tempSniffy, iMagicLampGadget);        //  Pop Sniffy out of the Lamp
  82.     SetVisible(tempSniffy, true);                    //  Necessary?  Won't hurt...
  83.     PlaySound(iConfirmSound);
  84.     
  85.     HopToTrash(tempSniffy);                            //  Send him hurling into the trash
  86.     DelayMilliseconds(1000);
  87.     
  88.     Destroy(tempSniffy);                            //    Kill him
  89.     PlaySound(iTrashSound);                            //  Play the trash drum sound
  90. }
  91.  
  92.  
  93. //
  94. //      Class:    InstallerKibble
  95. //
  96. //     Method:    InstallInto
  97. //
  98. //    Purpose:    Installs our hack after calling SnuffSniffy to provide
  99. //                an amusing animation sequence.  If you want to install hacks,
  100. //                this is one good way to do so.
  101. //
  102.  
  103. Method void InstallerKibble_InstallInto(ObjectID self, ObjectID newObject, Unsigned flags, ObjectID parameter, ObjectID unusedObsolete)
  104. {        
  105.     SnuffSniffy(self);                        //  Play untimely Sniffy death animation
  106.     
  107.     //    Install the new images in a friendly manner so when the package
  108.     //    is packed up or unexpectedly goes away, the old system images are
  109.     //    preserved.  If one were do use SetIndexical(...), when the package
  110.     //  was packed up, really evil nasty things would happen.
  111.     
  112.     InstallInto(iSystem, iFindButtonHackImage, 0, iFindButtonImage, nilObject);
  113.     InstallInto(iSystem, iStandingLookingHackImage1, 0, iStandingLookingImage1, nilObject);
  114.     InstallInto(iSystem, iStandingLookingHackImage2, 0, iStandingLookingImage2, nilObject);
  115.     InstallInto(iSystem, iStandingLookingForwardHackImage, 0, iStandingLookingForwardImage, nilObject);
  116.     InstallInto(iSystem, iWalkingHackImage1, 0, iWalkingImage1, nilObject);
  117.     InstallInto(iSystem, iWalkingHackImage2, 0, iWalkingImage2, nilObject);
  118.     InstallInto(iSystem, iWalkingHackImage3, 0, iWalkingImage3, nilObject);
  119.     InstallInto(iSystem, iWalkingHackImage4, 0, iWalkingImage4, nilObject);
  120.         
  121.     //    Break it to the user that their pooch is dead.
  122.     
  123.     Announce(iSniffyDeathAnnouncement);
  124.     
  125.     //    Always call the inherited method.
  126.     
  127.     InheritedInstallInto(self, newObject, flags, parameter, unusedObsolete);
  128. }
  129.  
  130. #undef CURRENTCLASS
  131.